<template>
  <div class="product-list">
    <h2>商品列表</h2>
    <div class="product-grid">
      <div v-for="item in products" :key="item.id" class="product-card">
        <img :src="item.image" alt="商品图片">
        <h3>{{ item.name }}</h3>
        <p>¥{{ item.price }}</p>
        <el-button type="primary">加入购物车</el-button>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'

const products = ref([
  { id: 1, name: '有机蔬菜', price: 39.9, image: 'https://example.com/veggies.jpg' },
  { id: 2, name: '生态大米', price: 59.9, image: 'https://example.com/rice.jpg' }
])
</script>

<style scoped>
.product-list {
  padding: 20px;
}

.product-card {
  border: 1px solid #eee;
  padding: 15px;
  margin-bottom: 20px;
  text-align: center;
}

.product-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}
</style>